package com.echo.code.thread.latch;

import java.util.concurrent.TimeoutException;

/**
 * Latch Created by baiyap on 2018/9/24.
 */
public abstract class Latch {

  protected int limit;

  public Latch(int limit) {
    this.limit = limit;
  }

  public abstract void await() throws InterruptedException;

  public abstract void await(long millis) throws InterruptedException, TimeoutException;

  public abstract void countDown();

  public String getCurrentThreadName() {
    return Thread.currentThread().getName();
  }
}
